Puppet::Type.newtype(:broker) do
	 @doc = "Manages OurGrid's broker configuration"

	#A base class for numeric Virt parameters validation.
	class VirtNumericParam < Puppet::Parameter

		def numfix(num)
			if num =~ /^\d+$/
				return num.to_i
			elsif num.is_a?(Integer)
				return num
			else
				return false
			end
		end

		validate do |value|
			if numfix(value)
				return value
			else
				self.fail "%s is not a valid %s" % [value, self.class.name]
			end
		end
	end


	ensurable

	newparam(:name, :varname => true) do
		desc "Name of resorce"
	end

	newproperty(:detectiontime, :parent => VirtNumericParam) do
		desc "Localhost detectiontime."
		##defaultto(60)
	end

	newproperty(:notify) do
		desc "File transfer notify progress"
		##defaultto("no")
	end

	newproperty(:servername) do
		desc "The XMPP servername"
		##defaultto("xmpp.ourgrid.org")
	end

	newproperty(:username) do
		desc "The XMPP username"
		##defaultto(facter.)
	end

	newproperty(:serverport, :parent => VirtNumericParam) do
		desc "The XMPP serverport"
		#defaultto(5222)
	end

	newproperty(:timeout, :parent => VirtNumericParam) do
		desc "File transfer timeout"
		#defaultto(600)
	end

	newproperty(:password) do
		desc "The XMPP password"
		#defaultto("xmpp-password")
	end

	newproperty(:maxtransfer, :parent => VirtNumericParam) do
		desc "Max simultaneous file transfer"
		#defaultto(10)
	end

	newproperty(:publickey) do
		desc "Publickey"
		#defaultto("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAB4CqZVyMoCqUP6u6FEB1vqzX6irkphPovC1km0EHJ6/e5jNTWAiwkeJuRIEKe6n2ZZo3C6T0CnHHqeNs+0IPM8QwQLJm8v3k41+a1zw6HIyuLmzIRosckjAjLcjoXQNsMFWOlLr8EOq1TKr5XRAY7nqxPhZU2oTpy5GzG8s7kQIDAQAB")
	end

	newproperty(:lanheartbeat, :parent => VirtNumericParam) do
		desc "Lan heartbeat delay"
		#defaultto(15)
	end

	newproperty(:serversecureport, :parent => VirtNumericParam) do
		desc "The XMPP secure serverport"
		#defaultto(5223)
	end

	newproperty(:wanheartbeat, :parent => VirtNumericParam) do
		desc "Wan heartbeat delay"
		#defaultto(60)
	end

	newproperty(:landetectiontime, :parent => VirtNumericParam) do
		desc "Lan detectiontime"
		#defaultto(180)
	end

	newproperty(:wandetectiontime, :parent => VirtNumericParam) do
		desc "Wan detectiontime"
		#defaultto(300)
	end

	newproperty(:usemonitor) do
		desc "Use monitor (true or false)"
		#defaultto("no")
	end

	newproperty(:localhostheartbeat, :parent => VirtNumericParam) do
		desc "Localhost heartbeat delay"
		#defaultto(5)
	end

	newproperty(:privatekey) do
		desc "Privatekey"
		#defaultto("MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIAHgKplXIygKpQ/q7oUQHW+rNfqKuSmE+i8LWSbQQcnr97mM1NYCLCR4m5EgQp7qfZlmjcLpPQKccep42z7Qg8zxDBAsmby/eTjX5rXPDocjK4ubMhGixySMCMtyOhdA2wwVY6UuvwQ6rVMqvldEBjuerE+FlTahOnLkbMbyzuRAgMBAAECgYAFSkoSwGV2mheoUIk0Ayo2s05JDbAACqy/7SajBZdGSGmH+FMemoChayXEEKiUWk/HkqMwqxaBzvysl2SCWE9+aibSWQinr9qu+LPJZZGsiRCbuWuEWk8ZeebMCdaFb0engU/XBQs/8QVZ4/4FbMO3bNmM0x+xLhmFBPo3nmiQAQJBANWB3iQqTkGUKCQchXpk3/fEmD+BbXD7bIuXNBlqTdmpcgzbx+g0sjBV11C/TVi70/dTdX0H+8Y64t68N1b4C1ECQQCZgo6gmKqbQcP9ZOriCLB6gs/JLVyNY3c11sPpZdth+OkH7ve/mFiZXoSdxbld1xZmnK0hz4xWNVAMSqZwe5xBAkEAoHkt5+zMSMn8qbeuM2IiXG2tKP40rdirqveItxmJTfHnwPZn+IWy8FV0skI29lymYpyeD82yVTnpTxQUXA+vIQJALYTKGBLM2/a3T+bhwx6CfgFV7bh2rjIlQiCpvQaH89gj+UdBzV02QFwHhOUBXzMNIGYq7FCns1RhpRNpoQb2QQJAInixL38LYLQWgrTB0zLbxVfb2y4fMjfFBTgb5vjQO+CK5m6+ZpSfTRSSEtAh0j/4JVpOIyXKuEuiaIcQe8ZawQ\=\=")
	end

end
